﻿<UserControl x:Class="Spenta.StreetCare.Silverlight.UserControls.FooterUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
    xmlns:ViewModels="clr-namespace:Spenta.StreetCare.Silverlight.MVVM.ViewModels" mc:Ignorable="d" d:DesignHeight="80" d:DesignWidth="800">

    <UserControl.Resources>
        <ViewModels:FooterViewModel x:Key="FooterViewModel" />
    </UserControl.Resources>

    <StackPanel Style="{StaticResource FooterBackStackPanel}">
        <StackPanel Orientation="Horizontal" Margin="17,0,0,0">
        	<dataInput:Label Margin="8,0,0,0" Style="{StaticResource LatestCommentsLabel}" Content="{Binding Literals.LatestComments}" />
        </StackPanel>
        <Grid Margin="20,0,10,0" DataContext="{StaticResource FooterViewModel}" d:DataContext="{d:DesignData /SampleData/FooterViewModelSampleData.xaml}">
            <ItemsControl ItemsSource="{Binding Comments}" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,5,10">
                            <Border Style="{StaticResource FooterImageBorder}" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="1" BorderThickness="1" Margin="3,0,0,0">
                                <Image Stretch="Uniform" Source="{Binding User.UserImageUrl}" />
                            </Border>
                            <StackPanel VerticalAlignment="Top" Margin="65,0,5,0">
                                <HyperlinkButton Command="{Binding Source={StaticResource FooterViewModel}, Path=LocateReportCommand}" CommandParameter="{Binding Report}">
                                    <StackPanel Orientation="Horizontal">
                                        <dataInput:Label Style="{StaticResource CommentLabel}" Content="{Binding User.UserNickname}" />
                                        <dataInput:Label Style="{StaticResource CommentLabel}" Content="{Binding Literals.Said, Source={StaticResource FooterViewModel}}" Margin="5,0" />
                                        <dataInput:Label Style="{StaticResource CommentLabel}" Content="{Binding CommentWhen, Converter={StaticResource DateConverter}}" />
                                    </StackPanel>
                                </HyperlinkButton>
                                <TextBlock MaxHeight="16" Style="{StaticResource CommentTextBlock}" Text="{Binding CommentText}" TextWrapping="Wrap" HorizontalAlignment="Left" MaxWidth="280" Margin="0" VerticalAlignment="Top" />
                                <inputToolkit:Rating Style="{StaticResource RatingStarsStyle}" ItemContainerStyle="{StaticResource RatingStyle}" Value="{Binding CommentRating}" ItemCount="5" HorizontalAlignment="Left"  Background="Transparent" SelectionMode="Continuous" IsEnabled="False" RenderTransformOrigin="1,1" Margin="0" VerticalAlignment="Top">
                                    <inputToolkit:Rating.Projection>
                                        <PlaneProjection LocalOffsetX="-36"/>
                                    </inputToolkit:Rating.Projection>
                                    <inputToolkit:Rating.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="0.75" ScaleY="0.75"/>
                                        </TransformGroup>
                                    </inputToolkit:Rating.RenderTransform>
                                </inputToolkit:Rating>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </Grid>
        
    </StackPanel>
</UserControl>
